home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
ttlps
/
ttlphoto.ctl
< prev
Wrap
Text File
|
1999-08-17
|
16KB
|
468 lines
VERSION 5.00
Begin VB.UserControl TTLSlide
AutoRedraw = -1 'True
BackColor = &H00808080&
ClientHeight = 2505
ClientLeft = 0
ClientTop = 0
ClientWidth = 2505
ClipControls = 0 'False
EditAtDesignTime= -1 'True
FillColor = &H00808080&
FillStyle = 0 'Solid
KeyPreview = -1 'True
ScaleHeight = 2505
ScaleWidth = 2505
ToolboxBitmap = "TTLPHO~1.ctx":0000
Begin VB.Frame FrameView
BackColor = &H00808080&
BorderStyle = 0 'None
Height = 3855
Left = 0
TabIndex = 0
ToolTipText = "TTL Slide Frame"
Top = 0
Visible = 0 'False
Width = 3855
Begin VB.Image Image2
BorderStyle = 1 'Fixed Single
Height = 255
Left = 5280
Top = 5880
Width = 255
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 2775
Left = -120
Top = 5760
Visible = 0 'False
Width = 135
End
End
End
Attribute VB_Name = "TTLSlide"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Default Property Values:
Const m_def_ToolTipText = ""
'Const m_def_ForeColor = 0
Const m_def_Enabled = 0
Const m_def_BackStyle = 0
Const m_def_BorderStyle = 0
'Const m_def_ToolTipText = ""
Const m_def_WhatsThisHelpID = 0
'Property Variables:
Dim m_ToolTipText As String
'Dim m_ForeColor As Long
Dim m_Enabled As Boolean
Dim m_BackStyle As Integer
Dim m_BorderStyle As Integer
'Dim m_ToolTipText As String
Dim m_WhatsThisHelpID As Long
Dim isSlide As Boolean
'Event Declarations:
Event Click() 'MappingInfo=Image2,Image2,-1,Click
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event DblClick() 'MappingInfo=Image2,Image2,-1,DblClick
Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
Event KeyDown(KeyCode As Integer, Shift As Integer)
Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
Event KeyPress(KeyAscii As Integer)
Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp
Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image2,Image2,-1,MouseDown
Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=Image2,Image2,-1,MouseMove
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
Event Show() 'MappingInfo=UserControl,UserControl,-1,Show
Attribute Show.VB_Description = "Occurs when the control's Visible property changes to True."
Private Sub TTLSlide_Resize()
Dim iW As Double, iH As Double
FrameView.Top = 0
FrameView.Left = 0
If Width > Height Then
FrameView.Width = Height
Else
FrameView.Width = Width
End If
FrameView.Height = FrameView.Width
Width = FrameView.Width
Height = FrameView.Height
End Sub '** TTLSlide_Resize
Public Function LoadImage(strImg As String, bSlide As Boolean) As Boolean
Dim iW As Double, iH As Double, iRespond As Integer
LoadImage = True
isSlide = bSlide
'** User load nothing
If strImg = "" Then
Image1.Picture = Nothing
Image2.Picture = Nothing
Image1.Visible = False
Image2.Visible = False
Exit Function
End If
If Not FrameView.Visible Then
FrameView.Visible = True
End If
On Error GoTo ImageChoiceErr
If FrameView.Width <> Width Or FrameView.Height <> Height Then
TTLSlide_Resize
End If
'** Check which image to be use
If Image1.Visible Then
Image2.Stretch = False
Image2.Picture = LoadPicture(strImg)
Image2.ToolTipText = strImg
iW = Image2.Picture.Width
iH = Image2.Picture.Height
'** Resize Image to fit in frame View
ImgResize 2, iW, iH
Else
Image1.Stretch = False
Image1.Picture = LoadPicture(strImg)
Image1.ToolTipText = strImg
iW = Image1.Picture.Width
iH = Image1.Picture.Height
ImgResize 1, iW, iH
End If
Exit Function
ImageChoiceErr:
LoadImage = False
MsgBox "Photo Slide can not display this type of image." & Chr(13) & _
"Please check the image's format.", vbCritical, "Error Loading Image"
Exit Function
End Function '** LoadImage
Private Sub ImgResize(imgNum, iW, iH)
Dim iMove As Double, iLeft As Double
If imgNum = 1 Then
Image1.Visible = False '** Hide while resize
Image1.Stretch = True
'** Calculate Width and Height
If iW > iH Then
Image1.Width = FrameView.Width * 0.9
Image1.Height = (Image1.Width * (iH / iW))
Image1.Left = FrameView.Width * 0.05
Image1.Top = (FrameView.Height - Image1.Height) / 2
Else
Image1.Height = FrameView.Width * 0.9
Image1.Width = (Image1.Height * (iW / iH))
Image1.Top = FrameView.Width * 0.05
Image1.Left = (FrameView.Width - Image1.Width) / 2
End If
Image1.Visible = True
'** If image view in normal size, then use slide in feature
If isSlide Then
If Width < 7400 Then
iLeft = Image1.Left
iMove = Width
Do While iMove > 0
iMove = iMove - 50
Image1.Left = iMove
If Image1.Left < iLeft Then
Image1.Left = iLeft
Exit Do
End If
Loop
End If
End If
'***************************
Image2.Visible = False
Else
Image2.Visible = False '** Hide while resize
Image2.Stretch = True
'** Calculate Width and Height
If iW > iH Then
Image2.Width = FrameView.Width * 0.9
Image2.Height = (Image2.Width * (iH / iW))
Image2.Left = FrameView.Width * 0.05
Image2.Top = (FrameView.Height - Image2.Height) / 2
Else
Image2.Height = FrameView.Height * 0.9
Image2.Width = (Image2.Height * (iW / iH))
Image2.Top = FrameView.Width * 0.05
Image2.Left = (FrameView.Width - Image2.Width) / 2
End If
Image2.Visible = True
'** If image view in normal size, then use slide in feature
If isSlide Then
If Width < 7400 Then
iLeft = Image2.Left
iMove = -Image2.Left
Do While iMove <= iLeft
iMove = iMove + 50
Image2.Left = iMove
If Image2.Left > iLeft Then